<?php
defined('SYSPATH') OR die('No direct access allowed.');
/**
 * lowongan.php
 * @author ranuandra
 *
 * 12 Mar 2012 14:09:35
 *
 * 
 */

class Model_Mstlowongan extends ORM
{
	protected $_has_many = array(
							'pelamarlowongan' 				=> array('model'	=> 'pelamarlowongan'),
							'proseslowongan'				=> array('model'	=> 'proseslowongan'),
							'mstplacements'       			=> array('model' 	=> 'mstplacement', 'through' => 'mstlowongans_mstplacements'),

						);
	protected $_belongs_to = array(
							'mstareaofwork'		=> array('model' 	=> 'mstareaofwork'),
							'mstplacement' 		=> array('model'	=> 'mstplacement'),
							'mstdepartment'		=> array('model'	=> 'mstdepartment'),
							'mstpendidikan'		=> array('model'	=> 'mstpendidikan'),
							'mstjabatan'		=> array('model'	=> 'mstjabatan'),
							'mstproses'			=> array('model'	=> 'mstproses'),
						);
	private $_field = array('kode', 'mstareaofwork_id', 'datefrom', 'dateto', 'mstdepartment_id', 'deskripsi', 'mstpendidikan_id', 'kualifikasi_umum', 'kualifikasi_khusus', 'publisheddate', 'mstjabatan_id', 'arsip');
	
	private $_form = array(
							'kode' => '', 
							'mstareaofwork_id' => '', 
							'datefrom' => '', 
							'dateto' => '', 
							'mstdepartment_id' => '', 
							'deskripsi' => '', 
							'mstpendidikan_id' => '', 
							'mstjabatan_id' => '', 
							'kualifikasi_umum' => '', 
							'kualifikasi_khusus' => '', 
							'publisheddate' => '', 
							'jabatan_id' => '', 
							'arsi' => ''
							);
	
	public function rules()
	{
		return array(
							'kode' => array(
										array('min_length', array(':value', 0)),
									 ), 
							'mstareaofwork_id' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'datefrom' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'dateto' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'mstdepartment_id' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'deskripsi' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'mstpendidikan_id' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'kualifikasi_umum' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'kualifikasi_khusus' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'publisheddate' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'mstjabatan_id' => array(
										array('min_length', array(':value', 0)),
									 ),  
							'arsi' => array(
										array('min_length', array(':value', 0)),
									 ), 
		
		); 
	}
	
	public function getField()
	{
		return $this->_field;
	}
	
	public function getForm()
	{
		return $this->_form;
	}
	
	public function create_data($values)
	{
	    return $this->values($values, $this->_field)->create();
	}	
}